Describe geometric anisotropy. Discuss this in the context of a data set.
Consider four points positioned on a unit circle.
How far apart are each set of points?
Now consider a set of correlation functions. For each, calculate the correlation matrix and discuss the impact of \(B\) on the correlation. Furthermore, how does B change the geometry of the correlation?
\(\rho() = \exp(-\boldsymbol{h_{ij}}^T B \boldsymbol{h_{ij}}^T)^{\frac{1}{2}})),\) where \(B = \begin{pmatrix} 1 & 0 \\ 0 & 1 \\ \end{pmatrix}\)
\(\rho() = \exp(-\boldsymbol{h_{ij}}^T B \boldsymbol{h_{ij}}^T)^{\frac{1}{2}})),\) where \(B = \begin{pmatrix} 2 & 0 \\ 0 & 1 \\ \end{pmatrix}\)
\(\rho() = \exp(-\boldsymbol{h_{ij}}^T B \boldsymbol{h_{ij}}^T)^{\frac{1}{2}})),\) where \(B = \begin{pmatrix} 3 & 1 \\ 1 & 1 \\ \end{pmatrix}\)
\(\rho() = \exp(-\boldsymbol{h_{ij}}^T I \boldsymbol{h_{ij}}^T)^{\frac{1}{2}}))\)
Implied Distance
| 0.00 | 1.41 | 1.41 | 2.00 |
| 1.41 | 0.00 | 2.00 | 1.41 |
| 1.41 | 2.00 | 0.00 | 1.41 |
| 2.00 | 1.41 | 1.41 | 0.00 |
Correlation
| 1.000 | 0.243 | 0.243 | 0.135 |
| 0.243 | 1.000 | 0.135 | 0.243 |
| 0.243 | 0.135 | 1.000 | 0.243 |
| 0.135 | 0.243 | 0.243 | 1.000 |
\(\rho() = \exp(-\boldsymbol{h_{ij}}^T B \boldsymbol{h_{ij}}^T)^{\frac{1}{2}})),\) where \(B = \begin{pmatrix} 2 & 0 \\ 0 & 1 \\ \end{pmatrix}\)
Implied Distance
| 0.00 | 1.73 | 1.73 | 2.83 |
| 1.73 | 0.00 | 2.00 | 1.73 |
| 1.73 | 2.00 | 0.00 | 1.73 |
| 2.83 | 1.73 | 1.73 | 0.00 |
Correlation
| 1.000 | 0.177 | 0.177 | 0.059 |
| 0.177 | 1.000 | 0.135 | 0.177 |
| 0.177 | 0.135 | 1.000 | 0.177 |
| 0.059 | 0.177 | 0.177 | 1.000 |
\(\rho() = \exp(-\boldsymbol{h_{ij}}^T B \boldsymbol{h_{ij}}^T)^{\frac{1}{2}})),\) where \(B = \begin{pmatrix} 3 & 1 \\ 1 & 1 \\ \end{pmatrix}\)
Implied Distance
| 0.00 | 1.41 | 2.45 | 3.46 |
| 1.41 | 0.00 | 2.00 | 2.45 |
| 2.45 | 2.00 | 0.00 | 1.41 |
| 3.46 | 2.45 | 1.41 | 0.00 |
Correlation
| 1.000 | 0.243 | 0.086 | 0.031 |
| 0.243 | 1.000 | 0.135 | 0.086 |
| 0.086 | 0.135 | 1.000 | 0.243 |
| 0.031 | 0.086 | 0.243 | 1.000 |
There are three components to a generalized linear model:
Write out the complete model specification for logistic regression.
glm()Interpret this output
CO <- CO %>% mutate(north = as.numeric(Latitude > 38 ))
glm(Exceedance~north, family=binomial(link = 'logit'),data=CO) %>% summary##
## Call:
## glm(formula = Exceedance ~ north, family = binomial(link = "logit"),
## data = CO)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.313 0.378 0.378 0.378 1.177
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.695e-15 8.165e-01 0.000 1.0000
## north 2.603e+00 1.097e+00 2.372 0.0177 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 28.708 on 34 degrees of freedom
## Residual deviance: 22.873 on 33 degrees of freedom
## AIC: 26.873
##
## Number of Fisher Scoring iterations: 5
JAGS specification for logistic regression
model{
# likelihood
for (i in 1:N){
y[i] ~ dbern(p[i])
p[i] <- 1 / (1 + exp(-eta[i]))
eta[i] <- int + x[i] * north
}
# prior
int ~ dnorm(0, 1E-12)
north ~ dnorm(0, 1E-12)
}
logistic.spatial <- "model {
for (i in 1:N) {
Y[i] ~ dbern(p[i])
logit(p[i]) <- mu[i] + w[i]
mu[i] <- beta[1]+beta[2]*x.north[i]
muW[i] <- 0
}
# process
w[1:N] ~ dmnorm(muW[],Omega[,])
# priors
beta[1] ~ dnorm(0.0,1E-8)
beta[2] ~ dnorm(0.0,1E-8)
spat.prec ~ dgamma(0.001, 0.001)
sigmasq <- 1/spat.prec
phi ~ dunif(1.5,2.5)
#build omega
for (i in 1:N){
for (j in 1:N){
H[i,j] <- (1/ spat.prec) * exp(-phi * d[i,j])
}
}
Omega[1:N,1:N] <- inverse(H[1:N,1:N])
}"
spGLM()m.1 <- spGLM(y~1,
family="binomial",
coords=coords,
weights=weights,
starting=list("beta"=beta.starting, "phi"=0.06,"sigma.sq"=1, "w"=0),
tuning=list("beta"=beta.tuning, "phi"=0.5, "sigma.sq"=0.5, "w"=0.5),
priors=list("beta.Normal"=list(0,10), "phi.Unif"=c(0.03, 0.3), "sigma.sq.IG"=c(2, 1)),
amcmc=list("n.batch"=n.batch, "batch.length"=batch.length, "accept.rate"=0.43),
cov.model="exponential",
verbose=TRUE,
n.report=10)
Write out the complete model specification for Poisson regression.
spGLM() accepts binomial and Poisson data,